{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "73876402-ebe0-4079-88a7-9ac6b7dbaae9",
   "metadata": {},
   "source": [
    "# Embed structurizr language-reference.md"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "3df2594d-d25d-4f3b-937a-d3fab1f303e6",
   "metadata": {},
   "source": [
    "## Create Embedding Model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "d8b8839e-6263-42ae-9ea0-ff2c3585d27b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Please define the following env variables in the .env file \n",
    "# \n",
    "# ollama_url = http://ollama:11434\n",
    "# embedding_model=nomic-embed-text\n",
    "# log_level=debug\n",
    "# "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "08dda744-1c51-4525-9a4b-5d11523c4236",
   "metadata": {},
   "outputs": [],
   "source": [
    "import utility\n",
    "embeddings = utility.get_embeddings()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "e70f15a9-75b4-4b30-be76-26ffb106565a",
   "metadata": {},
   "source": [
    "### Create LanceDB table and Vector Store"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "fd9fe723-6f9e-4549-8258-037127c59b69",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 227 ms, sys: 34.2 ms, total: 261 ms\n",
      "Wall time: 689 ms\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "# https://lancedb.github.io/lancedb/guides/tables/#creating-empty-table\n",
    "import pyarrow as pa\n",
    "import lancedb\n",
    "from langchain_community.vectorstores import LanceDB\n",
    "\n",
    "db = lancedb.connect(\"lancedb\")\n",
    "## create table with overwrite mode\n",
    "language = db.create_table(\"language\", data = [{\"vector\":embeddings.embed_query(\"language\"), \"text\":\"language\"}], mode = \"overwrite\")\n",
    "\n",
    "## connect to the existing table\n",
    "# language = db.open_table('language')\n",
    "\n",
    "language_vectorstore = LanceDB(language, embeddings)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "712e2883-d8de-402b-a871-8693fa446d7c",
   "metadata": {},
   "source": [
    "## Read language reference markdown document"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "c00c72a6-dbac-4397-a9d5-03c47e9b1f0c",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|██████████| 1/1 [00:00<00:00, 1463.47it/s]\n"
     ]
    }
   ],
   "source": [
    "from langchain_community.document_loaders import DirectoryLoader, TextLoader\n",
    "\n",
    "loader = DirectoryLoader('structurizr/dsl/docs', glob=\"language-reference.md\", show_progress=True, use_multithreading=True, loader_cls=TextLoader)\n",
    "\n",
    "markdown_documents = loader.load()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "f0c85072-8972-419b-b1b1-cb9abe9ec5f6",
   "metadata": {},
   "source": [
    "### Split markdown document by using MarkdownHeaderTextSplitter\n",
    "\n",
    "https://python.langchain.com/docs/modules/data_connection/document_transformers/markdown_header_metadata"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "id": "bdd9ec5d-48a9-44c8-b40a-37e2c876507c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 1.04 ms, sys: 3 µs, total: 1.05 ms\n",
      "Wall time: 1.05 ms\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "\n",
    "from langchain.text_splitter import MarkdownHeaderTextSplitter\n",
    "\n",
    "headers_to_split_on = [\n",
    "    # (\"#\", \"Header 1\"),\n",
    "    # (\"##\", \"Header 2\"),\n",
    "    (\"###\", \"keyword\"),\n",
    "]\n",
    "\n",
    "markdown_splitter = MarkdownHeaderTextSplitter(headers_to_split_on=headers_to_split_on)\n",
    "\n",
    "md_header_splits = markdown_splitter.split_text(markdown_documents[0].page_content)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "84eed277-4c37-4e81-b742-bd94d7d3410c",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[debug] [{}, {'keyword': 'Identifier scope'}, {'keyword': '!impliedRelationships'}, {'keyword': 'Plugins'}, {'keyword': 'Scripts'}, {'keyword': 'workspace'}, {'keyword': 'model'}, {'keyword': 'enterprise'}, {'keyword': 'group'}, {'keyword': 'person'}, {'keyword': 'softwareSystem'}, {'keyword': 'container'}, {'keyword': 'component'}, {'keyword': 'deploymentEnvironment'}, {'keyword': 'deploymentGroup'}, {'keyword': 'deploymentNode'}, {'keyword': 'infrastructureNode'}, {'keyword': 'softwareSystemInstance'}, {'keyword': 'containerInstance'}, {'keyword': 'healthCheck'}, {'keyword': 'element'}, {'keyword': 'relationship'}, {'keyword': 'tags'}, {'keyword': 'description'}, {'keyword': 'technology'}, {'keyword': 'instances'}, {'keyword': 'url'}, {'keyword': 'properties'}, {'keyword': 'perspectives'}, {'keyword': '!ref'}, {'keyword': 'views'}, {'keyword': 'systemLandscape view'}, {'keyword': 'systemContext view'}, {'keyword': 'container view'}, {'keyword': 'component view'}, {'keyword': 'filtered view'}, {'keyword': 'dynamic view'}, {'keyword': 'deployment view'}, {'keyword': 'custom view'}, {'keyword': 'image view'}, {'keyword': 'include'}, {'keyword': 'exclude'}, {'keyword': 'autoLayout'}, {'keyword': 'default'}, {'keyword': 'animation'}, {'keyword': 'title'}, {'keyword': 'styles'}, {'keyword': 'element style'}, {'keyword': 'relationship style'}, {'keyword': 'theme'}, {'keyword': 'themes'}, {'keyword': 'branding'}, {'keyword': 'terminology'}, {'keyword': 'configuration'}, {'keyword': 'users'}]\n"
     ]
    }
   ],
   "source": [
    "utility.debug([header.metadata for header in md_header_splits])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "70158bb5-39ab-4c6f-b74b-24f165fdee7b",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[debug] page_content='`workspace` is the top level language construct, and the wrapper for the [model](#model) and [views](#views). A workspace can optionally be given a name and description.  \\n```\\nworkspace [name] [description] {\\n...\\n}\\n```  \\nA workspace can also extend another workspace, to add more elements, relationships, views, etc to it.  \\n```\\nworkspace extends <file|url> {\\n...\\n}\\n```  \\nThe base workspace can either be referenced using a local DSL/JSON file, or a remote (via a HTTPS URL) DSL/JSON file.\\nWhen extending a DSL-based workspace, all of the identifiers defined in that workspace are available to use in the extended workspace.  \\nPermitted children:  \\n- name <name>\\n- description <description>\\n- [properties](#properties)\\n- [!docs](#documentation)\\n- [!adrs](#architecture-decision-records-adrs)\\n- [!identifiers](#identifier-scope)\\n- [!impliedRelationships](#impliedrelationships)\\n- [model](#model)\\n- [views](#views)\\n- [configuration](#configuration)' metadata={'keyword': 'workspace'}\n"
     ]
    }
   ],
   "source": [
    "utility.debug(md_header_splits[5])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "c40e67c6-8537-473c-aa82-fe19097518f2",
   "metadata": {},
   "source": [
    "### Embed markdown sections into vector store"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "37270d28-83d6-4fca-b7a3-a4c30d18682d",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 126 ms, sys: 25.4 ms, total: 151 ms\n",
      "Wall time: 44.4 s\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "## skip the first block\n",
    "result = language_vectorstore.add_documents(md_header_splits[1:])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "05bc86a0-772b-4ab9-8605-096d50bbe84b",
   "metadata": {},
   "source": [
    "### Similarity Search - Vectorstore"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "718c818d-c6df-44a0-8a0e-b795a4f33556",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "*******\n",
      "`workspace` is the top level language construct, and the wrapper for the [model](#model) and [views](#views). A workspace can optionally be given a name and description.  \n",
      "```\n",
      "workspace [name] [description] {\n",
      "...\n",
      "}\n",
      "```  \n",
      "A workspace can also extend another workspace, to add more elements, relationships, views, etc to it.  \n",
      "```\n",
      "workspace extends <file|url> {\n",
      "...\n",
      "}\n",
      "```  \n",
      "The base workspace can either be referenced using a local DSL/JSON file, or a remote (via a HTTPS URL) DSL/JSON file.\n",
      "When extending a DSL-based workspace, all of the identifiers defined in that workspace are available to use in the extended workspace.  \n",
      "Permitted children:  \n",
      "- name <name>\n",
      "- description <description>\n",
      "- [properties](#properties)\n",
      "- [!docs](#documentation)\n",
      "- [!adrs](#architecture-decision-records-adrs)\n",
      "- [!identifiers](#identifier-scope)\n",
      "- [!impliedRelationships](#impliedrelationships)\n",
      "- [model](#model)\n",
      "- [views](#views)\n",
      "- [configuration](#configuration)\n",
      "\n",
      "*******\n",
      "Each workspace can also contain one or more views, defined with the `views` block.  \n",
      "```\n",
      "views {\n",
      "...\n",
      "}\n",
      "```  \n",
      "The `views` block can contain the following:  \n",
      "- [systemLandscape](#systemLandscape-view)\n",
      "- [systemContext](#systemContext-view)\n",
      "- [container](#container-view)\n",
      "- [component](#component-view)\n",
      "- [filtered](#filtered-view)\n",
      "- [dynamic](#dynamic-view)\n",
      "- [deployment](#deployment-view)\n",
      "- [custom](#custom-view)\n",
      "- [image](#image-view)\n",
      "- [styles](#styles)\n",
      "- [theme](#theme)\n",
      "- [themes](#themes)\n",
      "- [branding](#branding)\n",
      "- [terminology](#terminology)\n",
      "- [properties](#properties)  \n",
      "If a workspace doesn't have a `views` block, or the `views` block doesn't define any views,\n",
      "a [default set of views](#convention-over-configuration-useful-defaults) will be defined for you.\n",
      "Defining one or more views in the `views` block will remove this default set of views,\n",
      "although they can be added back with a script if needed:  \n",
      "```\n",
      "!script groovy {\n",
      "workspace.views.createDefaultViews()\n",
      "}\n",
      "```\n",
      "\n",
      "*******\n",
      "The `users` block can be used to specify the users who should have read-only or read-write access to a workspace. Each username (e.g. e-mail address) and role pair should be specified on their own line. Valid roles are `read` (read-only) and `write` (read-write).  \n",
      "```\n",
      "users {\n",
      "<username> <read|write>\n",
      "}\n",
      "```  \n",
      "## Documentation  \n",
      "The `!docs` keyword can be used to attach Markdown/AsciiDoc documentation to the parent context (either the workspace, a software system, or a container).  \n",
      "```\n",
      "!docs <path> [fully qualified class name]\n",
      "```  \n",
      "The path must be a relative path, located within the same directory as the parent file, or a subdirectory of it. For example:  \n",
      "```\n",
      "!docs subdirectory\n",
      "```  \n",
      "By default, the [com.structurizr.importer.documentation.DefaultDocumentationImporter](https://github.com/structurizr/documentation/blob/main/src/main/java/com/structurizr/importer/documentation/DefaultDocumentationImporter.java) class will be used to import documentation as follows:  \n",
      "- All Markdown and AsciiDoc files in the given directory will be imported, alphabetically according to the filename.\n",
      "- All images in the given directory (and sub-directories) are also imported into the workspace.\n",
      "- See [Structurizr - Documentation - Headings and sections](https://structurizr.com/help/documentation/headings) for details about how section headings and numbering are handled.  \n",
      "The above behaviour can be customised by specifying the fully qualified class name of your own implementation of [DocumentationImporter](https://github.com/structurizr/documentation/blob/main/src/main/java/com/structurizr/importer/documentation/DocumentationImporter.java), which needs to be on the DSL classpath or installed as a JAR file in the `plugins` directory next to your DSL file.  \n",
      "## Architecture decision records (ADRs)  \n",
      "The `!adrs` keyword can be used to attach Markdown/AsciiDoc ADRs to the parent context (either the workspace, a software system, or a container).  \n",
      "```\n",
      "!adrs <path> [fully qualified class name]\n",
      "```  \n",
      "The path must be a relative path, located within the same directory as the parent file, or a subdirectory of it. For example:  \n",
      "```\n",
      "!adrs subdirectory\n",
      "```  \n",
      "By default, the [com.structurizr.documentation.importer.AdrToolsDecisionImporter](https://github.com/structurizr/documentation/blob/main/src/main/java/com/structurizr/documentation/importer/AdrToolsDecisionImporter.java) class will be used to import ADRs as follows:  \n",
      "- All Markdown files in this directory will be imported, alphabetically according to the filename.\n",
      "- The files must have been created by [adr-tools](https://github.com/npryce/adr-tools), or at least follow the same format.\n",
      "- All images in the given directory (and sub-directories) are also imported into the workspace.  \n",
      "The above behaviour can be customised by specifying the fully qualified class name of your own implementation of [DocumentationImporter](https://github.com/structurizr/documentation/blob/main/src/main/java/com/structurizr/documentation/importer/DocumentationImporter.java), which needs to be on the DSL classpath or installed as a JAR file in the `plugins` directory next to your DSL file.\n",
      "\n",
      "*******\n",
      "Plugins can be used where more control or customisation is required, and provide access to the workspace via the [Structurizr for Java library](https://github.com/structurizr/java). For example, you could use a plugin to create model elements based upon an external data source, or perhaps define views programmatically. Plugins can be used at any point in the DSL.  \n",
      "To write a plugin, create a Java class that implements the `com.structurizr.dsl.StructurizrDslPlugin` interface (you will need to add a dependency on the DSL library, which can be found on Maven Central via `com.structurizr:structurizr-dsl`).  \n",
      "```\n",
      "package com.example;\n",
      "\n",
      "import com.structurizr.Workspace;\n",
      "\n",
      "public class TestPlugin implements StructurizrDslPlugin {\n",
      "\n",
      "@Override\n",
      "public void run(StructurizrDslPluginContext context) {\n",
      "Workspace workspace = context.getWorkspace();\n",
      "workspace.setName(\"Name set by plugin\");\n",
      "}\n",
      "\n",
      "}\n",
      "```  \n",
      "The compiled plugin packaged as a JAR file (plus any other JAR dependencies) should be placed in a directory named `plugins` next to your DSL file. You can then use your plugin from the DSL using the `!plugin` keyword.  \n",
      "```\n",
      "workspace {\n",
      "\n",
      "!plugin com.example.TestPlugin\n",
      "\n",
      "}\n",
      "```  \n",
      "Parameters can be specified in the plugin body, for example.  \n",
      "```\n",
      "workspace {\n",
      "\n",
      "!plugin com.example.TestPlugin {\n",
      "name value\n",
      "}\n",
      "\n",
      "}\n",
      "```  \n",
      "The named parameters are then available via the `getParameter(name)` method of the `StructurizrDslPluginContext`object.\n",
      "\n",
      "CPU times: user 17.4 ms, sys: 283 µs, total: 17.7 ms\n",
      "Wall time: 308 ms\n"
     ]
    }
   ],
   "source": [
    "%%time\n",
    "\n",
    "result = language_vectorstore.similarity_search(\"workspace\")\n",
    "for doc in result:\n",
    "    print(f'*******\\n{doc.page_content}\\n', flush=True)\n",
    "\n",
    "# utility.debug([doc.page_content for doc in result])"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "bf13d268-c8cd-48a4-b50c-22789aefc6f2",
   "metadata": {},
   "source": [
    "### Similarity Search - Table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "14ae9e81-87d2-4bd3-b909-05db2b874de0",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "CPU times: user 6.39 ms, sys: 106 µs, total: 6.49 ms\n",
      "Wall time: 70.9 ms\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>vector</th>\n",
       "      <th>text</th>\n",
       "      <th>_distance</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>[-0.33670062, 1.2278049, -2.112366, -1.9728575...</td>\n",
       "      <td>`workspace` is the top level language construc...</td>\n",
       "      <td>373.391968</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>[-0.30997935, 1.7325505, -2.343408, -2.0346582...</td>\n",
       "      <td>Each workspace can also contain one or more vi...</td>\n",
       "      <td>451.360840</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>[0.6004354, 0.82819587, -1.8993403, -0.694243,...</td>\n",
       "      <td>The `users` block can be used to specify the u...</td>\n",
       "      <td>463.861816</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>[-0.20617998, 0.962884, -2.349823, -1.5633563,...</td>\n",
       "      <td>Plugins can be used where more control or cust...</td>\n",
       "      <td>469.880096</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>[-0.0049624015, 0.038244, -2.0738058, -1.69184...</td>\n",
       "      <td>Scripts are like plugins, except they don't ne...</td>\n",
       "      <td>480.580841</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>[-0.026458343, 0.5326862, -3.0214891, -1.14834...</td>\n",
       "      <td>The `deployment` keyword defines a [Deployment...</td>\n",
       "      <td>507.392761</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>[-1.0525703, 1.6705067, -1.9858038, -1.7433542...</td>\n",
       "      <td>Each workspace must contain a `model` block, i...</td>\n",
       "      <td>517.849487</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>[0.23981102, 1.1563656, -2.5503106, -1.6009854...</td>\n",
       "      <td>To enable automatic layout mode for the diagra...</td>\n",
       "      <td>530.530640</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>[-0.1733656, 1.0427052, -2.2759757, -1.4044012...</td>\n",
       "      <td>The `container` keyword is used to define a [C...</td>\n",
       "      <td>532.269653</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>[0.19340214, 0.9999751, -2.2851622, -1.4805528...</td>\n",
       "      <td>The `systemContext` keyword is used to define ...</td>\n",
       "      <td>535.253906</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>[0.07320713, 1.2278894, -2.3165853, -1.4297223...</td>\n",
       "      <td>The `include` keyword can be used to include e...</td>\n",
       "      <td>538.534668</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>[-0.5628838, 0.87987506, -2.0496187, -1.536586...</td>\n",
       "      <td>By default, all identifiers are treated as bei...</td>\n",
       "      <td>542.401917</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>[-0.088236876, 0.65954864, -2.3398294, -1.5662...</td>\n",
       "      <td>The `component` keyword is used to define a [C...</td>\n",
       "      <td>542.628967</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>[-0.9609333, 2.2338219, -2.5938764, -1.2648449...</td>\n",
       "      <td>__This concept has been deprecated - please us...</td>\n",
       "      <td>546.706177</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>[0.31543615, 1.0592995, -2.6031163, -1.5480356...</td>\n",
       "      <td>The `systemLandscape` keyword is used to defin...</td>\n",
       "      <td>550.032898</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>[-0.3582434, 1.124225, -2.591029, -1.3609573, ...</td>\n",
       "      <td>`technology` is used to set the technology on ...</td>\n",
       "      <td>552.630554</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>[-0.28211984, 1.4800606, -2.2550662, -0.755128...</td>\n",
       "      <td>The `image` keyword is used to define an [imag...</td>\n",
       "      <td>554.140503</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>[-0.11002864, 1.4990152, -2.2419536, -1.782816...</td>\n",
       "      <td>The `terminology` keyword allows you to overri...</td>\n",
       "      <td>555.324036</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>[-0.7073301, 0.7382454, -1.986404, -2.0131886,...</td>\n",
       "      <td>`-&gt;` is used to define a uni-directional relat...</td>\n",
       "      <td>557.124023</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>[0.15255517, 0.87311226, -2.585154, -0.7414668...</td>\n",
       "      <td>The `dynamic` keyword defines a [Dynamic view]...</td>\n",
       "      <td>565.820679</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>[0.37250596, 1.447344, -2.0253308, -1.1621063,...</td>\n",
       "      <td>```\\n!impliedRelationships &lt;true|false&gt;\\n```  ...</td>\n",
       "      <td>570.104675</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>[0.20546973, 1.2957637, -1.8548952, -1.5843176...</td>\n",
       "      <td>The `!ref` keyword provides a way to reference...</td>\n",
       "      <td>571.280823</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>[-0.6717214, 1.2898763, -2.5991018, -2.035781,...</td>\n",
       "      <td>The `containerInstance` keyword defines an ins...</td>\n",
       "      <td>574.596008</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>[-0.41518936, 1.423356, -2.6090384, -1.7921803...</td>\n",
       "      <td>The `softwareSystemInstance` keyword defines a...</td>\n",
       "      <td>578.061890</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>[-0.05241118, 1.252078, -3.2181742, -1.5166566...</td>\n",
       "      <td>The `deploymentGroup` keyword provides a way t...</td>\n",
       "      <td>578.290649</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>[-0.29891592, 1.0644528, -2.6517973, -1.551226...</td>\n",
       "      <td>The `deploymentEnvironment` keyword provides a...</td>\n",
       "      <td>581.772888</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>[-0.6342986, 1.576113, -1.7834135, -1.9830518,...</td>\n",
       "      <td>The `container` keyword defines a container, w...</td>\n",
       "      <td>584.084595</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>[-0.69137174, 1.76527, -2.4682214, -1.5784442,...</td>\n",
       "      <td>The `branding` keyword allows you to define so...</td>\n",
       "      <td>591.091736</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>[-0.50019395, 1.6667416, -1.8699179, -1.713685...</td>\n",
       "      <td>The `softwareSystem` keyword defines a softwar...</td>\n",
       "      <td>591.285095</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>[0.14838773, 0.8423605, -2.1793885, -2.1064174...</td>\n",
       "      <td>The `perspectives` block is used to define one...</td>\n",
       "      <td>594.114075</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>[-0.4021402, 0.9831043, -1.8173904, -2.17865, ...</td>\n",
       "      <td>The `component` keyword defines a component, w...</td>\n",
       "      <td>596.434937</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>[0.07643772, 1.3232709, -2.3958294, -1.668144,...</td>\n",
       "      <td>The `custom` keyword is used to define a [cust...</td>\n",
       "      <td>596.927063</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>[-0.56680304, 1.2758007, -3.236624, -1.8291943...</td>\n",
       "      <td>The `infrastructureNode` keyword defines an in...</td>\n",
       "      <td>598.005310</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>[0.29183665, 1.322296, -2.4708319, -1.3975025,...</td>\n",
       "      <td>The `filtered` keyword is used to define a [Fi...</td>\n",
       "      <td>598.110474</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>[0.1194943, 1.4952826, -2.6944747, -1.2134104,...</td>\n",
       "      <td>The `relationship` keyword is used to define a...</td>\n",
       "      <td>602.092834</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>[-0.20543793, 1.1522974, -2.8637085, -1.627123...</td>\n",
       "      <td>The `deploymentNode` keyword is used to define...</td>\n",
       "      <td>602.113770</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>[-0.23610686, 1.9626985, -2.3955538, -1.343854...</td>\n",
       "      <td>`url` is used to set a URL on an element or re...</td>\n",
       "      <td>604.140137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>[-0.98964024, 1.844223, -2.3665888, -1.2222686...</td>\n",
       "      <td>The `group` keyword provides a way to define a...</td>\n",
       "      <td>612.676575</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>[-0.040862687, 1.7457681, -2.585074, -1.732325...</td>\n",
       "      <td>The `themes` keyword can be used to specify on...</td>\n",
       "      <td>612.734985</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>[0.08266517, 1.7234871, -2.6325738, -1.8256078...</td>\n",
       "      <td>The `theme` keyword can be used to specify a t...</td>\n",
       "      <td>614.767395</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>[-0.42758244, 1.3485317, -2.325788, -1.4833511...</td>\n",
       "      <td>The `element` keyword defines a [custom elemen...</td>\n",
       "      <td>620.996948</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>[0.92363065, 1.2323397, -1.6603336, -1.5718861...</td>\n",
       "      <td>The `exclude` keyword can be used to exclude e...</td>\n",
       "      <td>624.273560</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>[-0.48088658, 1.9643681, -1.9455639, -1.279672...</td>\n",
       "      <td>The `animation` keyword defines the animation ...</td>\n",
       "      <td>626.174683</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>[0.09025356, 0.5167115, -2.5474935, -2.0308912...</td>\n",
       "      <td>`description` is used to set the description o...</td>\n",
       "      <td>632.095398</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>[0.6143544, 1.4627659, -3.2263398, -1.8705996,...</td>\n",
       "      <td>`instances` is used to set the number of insta...</td>\n",
       "      <td>636.095337</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>[0.017959602, 1.8943257, -1.7284672, -1.067099...</td>\n",
       "      <td>Finally, there are some configuration options ...</td>\n",
       "      <td>640.987427</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>[-0.61618984, 1.033455, -2.1544619, -2.1411262...</td>\n",
       "      <td>The `person` keyword defines a person (e.g. a ...</td>\n",
       "      <td>643.927673</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47</th>\n",
       "      <td>[0.82887983, 0.7220945, -2.2033103, -1.2896274...</td>\n",
       "      <td>Overrides the title of the view.  \\n```\\ntitle...</td>\n",
       "      <td>643.929199</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>48</th>\n",
       "      <td>[0.84674233, 1.1831189, -2.7315495, -0.6886803...</td>\n",
       "      <td>The `healthCheck` keyword defines a HTTP healt...</td>\n",
       "      <td>645.973633</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>49</th>\n",
       "      <td>[0.6200817, 1.1642646, -2.274022, -1.2427652, ...</td>\n",
       "      <td>The `properties` block is used to define one o...</td>\n",
       "      <td>655.328735</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50</th>\n",
       "      <td>[-1.0052896, 1.3758806, -2.2534378, -1.9661107...</td>\n",
       "      <td>`styles` is the wrapper for one or more elemen...</td>\n",
       "      <td>659.158020</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>51</th>\n",
       "      <td>[0.28640598, 1.3756645, -2.9207947, -1.348126,...</td>\n",
       "      <td>Sets the default view to be shown.  \\n```\\ndef...</td>\n",
       "      <td>666.639282</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>52</th>\n",
       "      <td>[-0.684283, 1.2003374, -2.265013, -2.291487, 1...</td>\n",
       "      <td>`tags` is used to add tags to an element or re...</td>\n",
       "      <td>677.796997</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>53</th>\n",
       "      <td>[0.5575216, 0.8206374, -1.7217709, -1.4968065,...</td>\n",
       "      <td>language</td>\n",
       "      <td>784.180237</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54</th>\n",
       "      <td>[-0.8813248, 1.8866708, -3.6268733, -0.2731394...</td>\n",
       "      <td>The `element` keyword is used to define an ele...</td>\n",
       "      <td>791.133850</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                               vector  \\\n",
       "0   [-0.33670062, 1.2278049, -2.112366, -1.9728575...   \n",
       "1   [-0.30997935, 1.7325505, -2.343408, -2.0346582...   \n",
       "2   [0.6004354, 0.82819587, -1.8993403, -0.694243,...   \n",
       "3   [-0.20617998, 0.962884, -2.349823, -1.5633563,...   \n",
       "4   [-0.0049624015, 0.038244, -2.0738058, -1.69184...   \n",
       "5   [-0.026458343, 0.5326862, -3.0214891, -1.14834...   \n",
       "6   [-1.0525703, 1.6705067, -1.9858038, -1.7433542...   \n",
       "7   [0.23981102, 1.1563656, -2.5503106, -1.6009854...   \n",
       "8   [-0.1733656, 1.0427052, -2.2759757, -1.4044012...   \n",
       "9   [0.19340214, 0.9999751, -2.2851622, -1.4805528...   \n",
       "10  [0.07320713, 1.2278894, -2.3165853, -1.4297223...   \n",
       "11  [-0.5628838, 0.87987506, -2.0496187, -1.536586...   \n",
       "12  [-0.088236876, 0.65954864, -2.3398294, -1.5662...   \n",
       "13  [-0.9609333, 2.2338219, -2.5938764, -1.2648449...   \n",
       "14  [0.31543615, 1.0592995, -2.6031163, -1.5480356...   \n",
       "15  [-0.3582434, 1.124225, -2.591029, -1.3609573, ...   \n",
       "16  [-0.28211984, 1.4800606, -2.2550662, -0.755128...   \n",
       "17  [-0.11002864, 1.4990152, -2.2419536, -1.782816...   \n",
       "18  [-0.7073301, 0.7382454, -1.986404, -2.0131886,...   \n",
       "19  [0.15255517, 0.87311226, -2.585154, -0.7414668...   \n",
       "20  [0.37250596, 1.447344, -2.0253308, -1.1621063,...   \n",
       "21  [0.20546973, 1.2957637, -1.8548952, -1.5843176...   \n",
       "22  [-0.6717214, 1.2898763, -2.5991018, -2.035781,...   \n",
       "23  [-0.41518936, 1.423356, -2.6090384, -1.7921803...   \n",
       "24  [-0.05241118, 1.252078, -3.2181742, -1.5166566...   \n",
       "25  [-0.29891592, 1.0644528, -2.6517973, -1.551226...   \n",
       "26  [-0.6342986, 1.576113, -1.7834135, -1.9830518,...   \n",
       "27  [-0.69137174, 1.76527, -2.4682214, -1.5784442,...   \n",
       "28  [-0.50019395, 1.6667416, -1.8699179, -1.713685...   \n",
       "29  [0.14838773, 0.8423605, -2.1793885, -2.1064174...   \n",
       "30  [-0.4021402, 0.9831043, -1.8173904, -2.17865, ...   \n",
       "31  [0.07643772, 1.3232709, -2.3958294, -1.668144,...   \n",
       "32  [-0.56680304, 1.2758007, -3.236624, -1.8291943...   \n",
       "33  [0.29183665, 1.322296, -2.4708319, -1.3975025,...   \n",
       "34  [0.1194943, 1.4952826, -2.6944747, -1.2134104,...   \n",
       "35  [-0.20543793, 1.1522974, -2.8637085, -1.627123...   \n",
       "36  [-0.23610686, 1.9626985, -2.3955538, -1.343854...   \n",
       "37  [-0.98964024, 1.844223, -2.3665888, -1.2222686...   \n",
       "38  [-0.040862687, 1.7457681, -2.585074, -1.732325...   \n",
       "39  [0.08266517, 1.7234871, -2.6325738, -1.8256078...   \n",
       "40  [-0.42758244, 1.3485317, -2.325788, -1.4833511...   \n",
       "41  [0.92363065, 1.2323397, -1.6603336, -1.5718861...   \n",
       "42  [-0.48088658, 1.9643681, -1.9455639, -1.279672...   \n",
       "43  [0.09025356, 0.5167115, -2.5474935, -2.0308912...   \n",
       "44  [0.6143544, 1.4627659, -3.2263398, -1.8705996,...   \n",
       "45  [0.017959602, 1.8943257, -1.7284672, -1.067099...   \n",
       "46  [-0.61618984, 1.033455, -2.1544619, -2.1411262...   \n",
       "47  [0.82887983, 0.7220945, -2.2033103, -1.2896274...   \n",
       "48  [0.84674233, 1.1831189, -2.7315495, -0.6886803...   \n",
       "49  [0.6200817, 1.1642646, -2.274022, -1.2427652, ...   \n",
       "50  [-1.0052896, 1.3758806, -2.2534378, -1.9661107...   \n",
       "51  [0.28640598, 1.3756645, -2.9207947, -1.348126,...   \n",
       "52  [-0.684283, 1.2003374, -2.265013, -2.291487, 1...   \n",
       "53  [0.5575216, 0.8206374, -1.7217709, -1.4968065,...   \n",
       "54  [-0.8813248, 1.8866708, -3.6268733, -0.2731394...   \n",
       "\n",
       "                                                 text   _distance  \n",
       "0   `workspace` is the top level language construc...  373.391968  \n",
       "1   Each workspace can also contain one or more vi...  451.360840  \n",
       "2   The `users` block can be used to specify the u...  463.861816  \n",
       "3   Plugins can be used where more control or cust...  469.880096  \n",
       "4   Scripts are like plugins, except they don't ne...  480.580841  \n",
       "5   The `deployment` keyword defines a [Deployment...  507.392761  \n",
       "6   Each workspace must contain a `model` block, i...  517.849487  \n",
       "7   To enable automatic layout mode for the diagra...  530.530640  \n",
       "8   The `container` keyword is used to define a [C...  532.269653  \n",
       "9   The `systemContext` keyword is used to define ...  535.253906  \n",
       "10  The `include` keyword can be used to include e...  538.534668  \n",
       "11  By default, all identifiers are treated as bei...  542.401917  \n",
       "12  The `component` keyword is used to define a [C...  542.628967  \n",
       "13  __This concept has been deprecated - please us...  546.706177  \n",
       "14  The `systemLandscape` keyword is used to defin...  550.032898  \n",
       "15  `technology` is used to set the technology on ...  552.630554  \n",
       "16  The `image` keyword is used to define an [imag...  554.140503  \n",
       "17  The `terminology` keyword allows you to overri...  555.324036  \n",
       "18  `->` is used to define a uni-directional relat...  557.124023  \n",
       "19  The `dynamic` keyword defines a [Dynamic view]...  565.820679  \n",
       "20  ```\\n!impliedRelationships <true|false>\\n```  ...  570.104675  \n",
       "21  The `!ref` keyword provides a way to reference...  571.280823  \n",
       "22  The `containerInstance` keyword defines an ins...  574.596008  \n",
       "23  The `softwareSystemInstance` keyword defines a...  578.061890  \n",
       "24  The `deploymentGroup` keyword provides a way t...  578.290649  \n",
       "25  The `deploymentEnvironment` keyword provides a...  581.772888  \n",
       "26  The `container` keyword defines a container, w...  584.084595  \n",
       "27  The `branding` keyword allows you to define so...  591.091736  \n",
       "28  The `softwareSystem` keyword defines a softwar...  591.285095  \n",
       "29  The `perspectives` block is used to define one...  594.114075  \n",
       "30  The `component` keyword defines a component, w...  596.434937  \n",
       "31  The `custom` keyword is used to define a [cust...  596.927063  \n",
       "32  The `infrastructureNode` keyword defines an in...  598.005310  \n",
       "33  The `filtered` keyword is used to define a [Fi...  598.110474  \n",
       "34  The `relationship` keyword is used to define a...  602.092834  \n",
       "35  The `deploymentNode` keyword is used to define...  602.113770  \n",
       "36  `url` is used to set a URL on an element or re...  604.140137  \n",
       "37  The `group` keyword provides a way to define a...  612.676575  \n",
       "38  The `themes` keyword can be used to specify on...  612.734985  \n",
       "39  The `theme` keyword can be used to specify a t...  614.767395  \n",
       "40  The `element` keyword defines a [custom elemen...  620.996948  \n",
       "41  The `exclude` keyword can be used to exclude e...  624.273560  \n",
       "42  The `animation` keyword defines the animation ...  626.174683  \n",
       "43  `description` is used to set the description o...  632.095398  \n",
       "44  `instances` is used to set the number of insta...  636.095337  \n",
       "45  Finally, there are some configuration options ...  640.987427  \n",
       "46  The `person` keyword defines a person (e.g. a ...  643.927673  \n",
       "47  Overrides the title of the view.  \\n```\\ntitle...  643.929199  \n",
       "48  The `healthCheck` keyword defines a HTTP healt...  645.973633  \n",
       "49  The `properties` block is used to define one o...  655.328735  \n",
       "50  `styles` is the wrapper for one or more elemen...  659.158020  \n",
       "51  Sets the default view to be shown.  \\n```\\ndef...  666.639282  \n",
       "52  `tags` is used to add tags to an element or re...  677.796997  \n",
       "53                                           language  784.180237  \n",
       "54  The `element` keyword is used to define an ele...  791.133850  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "%%time\n",
    "\n",
    "language.search(embeddings.embed_query(\"workspace\")) \\\n",
    "    .limit(100) \\\n",
    "    .nprobes(20) \\\n",
    "    .refine_factor(10) \\\n",
    "    .to_pandas()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "db83dc0f-e28b-4370-8f72-b2e1abe39a7e",
   "metadata": {},
   "source": [
    "### Similarity Search - Retriever"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "5ff4715b-697a-4991-bf3d-ecb1748a754e",
   "metadata": {},
   "outputs": [],
   "source": [
    "# retriever = language_vectorstore.as_retriever()\n",
    "retriever = language_vectorstore.as_retriever(search_kwargs={\"k\": 1})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "955f8a00-7fa2-4ca0-ab76-145eb8da085a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[debug] ['`workspace` is the top level language construct, and the wrapper for the [model](#model) and [views](#views). A workspace can optionally be given a name and description.  \\n```\\nworkspace [name] [description] {\\n...\\n}\\n```  \\nA workspace can also extend another workspace, to add more elements, relationships, views, etc to it.  \\n```\\nworkspace extends <file|url> {\\n...\\n}\\n```  \\nThe base workspace can either be referenced using a local DSL/JSON file, or a remote (via a HTTPS URL) DSL/JSON file.\\nWhen extending a DSL-based workspace, all of the identifiers defined in that workspace are available to use in the extended workspace.  \\nPermitted children:  \\n- name <name>\\n- description <description>\\n- [properties](#properties)\\n- [!docs](#documentation)\\n- [!adrs](#architecture-decision-records-adrs)\\n- [!identifiers](#identifier-scope)\\n- [!impliedRelationships](#impliedrelationships)\\n- [model](#model)\\n- [views](#views)\\n- [configuration](#configuration)']\n"
     ]
    }
   ],
   "source": [
    "result = retriever.get_relevant_documents(\"workspace\")\n",
    "\n",
    "utility.debug([doc.page_content for doc in result])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "dfb8e7d2-f62d-453a-89a2-f4403db2943c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[Document(page_content='`workspace` is the top level language construct, and the wrapper for the [model](#model) and [views](#views). A workspace can optionally be given a name and description.  \\n```\\nworkspace [name] [description] {\\n...\\n}\\n```  \\nA workspace can also extend another workspace, to add more elements, relationships, views, etc to it.  \\n```\\nworkspace extends <file|url> {\\n...\\n}\\n```  \\nThe base workspace can either be referenced using a local DSL/JSON file, or a remote (via a HTTPS URL) DSL/JSON file.\\nWhen extending a DSL-based workspace, all of the identifiers defined in that workspace are available to use in the extended workspace.  \\nPermitted children:  \\n- name <name>\\n- description <description>\\n- [properties](#properties)\\n- [!docs](#documentation)\\n- [!adrs](#architecture-decision-records-adrs)\\n- [!identifiers](#identifier-scope)\\n- [!impliedRelationships](#impliedrelationships)\\n- [model](#model)\\n- [views](#views)\\n- [configuration](#configuration)', metadata={'vector': [-0.3367006182670593, 1.2278048992156982, -2.112365961074829, -1.9728574752807617, 0.7058570981025696, -0.9843620657920837, 0.026085492223501205, 0.3938854932785034, -0.231288343667984, -0.9752561450004578, -0.5551283955574036, 0.6621705293655396, 2.3993306159973145, 0.33369138836860657, 0.2145831286907196, -0.5312903523445129, -0.2813478112220764, -0.5297631025314331, 0.21259911358356476, -0.788287878036499, -0.18844151496887207, -0.9259121417999268, -0.565975546836853, -0.30752310156822205, 1.570773720741272, 0.7944910526275635, -0.033112820237874985, -0.02603111043572426, -0.32024842500686646, 0.11862557381391525, 0.342608779668808, 0.08456483483314514, 0.5716313123703003, 0.01584353856742382, -0.8633930683135986, -1.231186866760254, 0.34324565529823303, 0.7701078057289124, -1.383244514465332, 0.33117786049842834, 0.15099765360355377, -0.40626490116119385, -0.06096888706088066, -1.3314510583877563, 0.03238961845636368, -0.7728101015090942, 0.21849650144577026, -1.0478403568267822, 0.8518261313438416, -0.7833083271980286, -0.4201163053512573, -0.2101636677980423, 0.07819338887929916, -0.057088159024715424, 1.7119050025939941, 0.1892501413822174, -0.5750680565834045, 0.4822505712509155, -0.16687780618667603, -0.4560264050960541, 1.2092630863189697, 2.0215392112731934, -0.2648670971393585, 1.4741261005401611, 0.6891084909439087, 0.7842545509338379, -1.113184928894043, 0.5277273654937744, -0.31389155983924866, -1.2887463569641113, 0.8526769280433655, 0.6378214955329895, 0.1437039077281952, -0.5964949727058411, -0.9651527404785156, 0.8437082171440125, 0.1437482237815857, -0.4200803339481354, -0.37055468559265137, 0.8156977295875549, -0.6957245469093323, 0.4879165589809418, 0.8247957229614258, -0.865371823310852, 1.1859409809112549, 0.7592555284500122, -0.1710352599620819, 0.023159021511673927, -0.10780738294124603, 1.6964863538742065, 0.4368153214454651, -0.5411785244941711, 0.3460215628147125, 0.41555312275886536, -1.4881867170333862, -0.07437116652727127, 0.03157360479235649, 0.1721964031457901, -0.2820557653903961, -0.6814295053482056, -0.5198372006416321, -0.6527621746063232, 0.948802649974823, 0.03341073915362358, 0.11204300820827484, 1.2726757526397705, -0.39417585730552673, 0.21327774226665497, 0.15379205346107483, -0.45569032430648804, -0.1067129448056221, 0.45713165402412415, -0.44171154499053955, -0.48799562454223633, 0.016486160457134247, -1.0558643341064453, 1.0491864681243896, -0.6140947937965393, -0.37068119645118713, 0.6544051170349121, -0.3183073103427887, 0.563012957572937, -0.009177306666970253, 0.710185706615448, 0.6872475147247314, 0.24706344306468964, -0.7709643244743347, -0.9625343680381775, 0.6527290940284729, -0.4367077648639679, -0.16061536967754364, -0.35950279235839844, -0.682344377040863, 0.5976106524467468, 0.15863537788391113, 0.6282382607460022, -0.3898770213127136, -0.6778547167778015, -0.3715984523296356, 0.4620487093925476, -0.13925884664058685, 0.8972252607345581, -0.4240851402282715, -0.5851973295211792, 0.38539913296699524, -1.0009180307388306, 0.9440548419952393, -0.05917004495859146, 0.23201173543930054, 0.656200647354126, -0.6069929599761963, 0.9945002794265747, -1.0336251258850098, 0.4890798032283783, 0.649980366230011, -0.6917913556098938, 0.33836352825164795, -0.1963425576686859, 0.6337765455245972, 0.7491371631622314, 1.0446140766143799, 0.9499197602272034, -1.0490530729293823, 1.0408082008361816, -0.5004414916038513, -1.275759220123291, 0.874566912651062, 0.42438268661499023, 0.2922664284706116, 0.33657586574554443, -0.27614152431488037, -0.8048730492591858, -0.04948223754763603, -0.15749338269233704, 0.09377798438072205, 0.030154520645737648, 1.0683174133300781, -1.1606632471084595, -0.533475935459137, -0.5438038110733032, 0.6034690737724304, -1.2038781642913818, 0.48711320757865906, 0.5952664613723755, 0.353060245513916, 0.924433171749115, -0.012288931757211685, -1.112205147743225, -0.05039103701710701, -0.9413174986839294, -0.7103923559188843, 0.3760039508342743, -0.20609109103679657, 0.3317583203315735, -0.8788817524909973, -1.136189579963684, 0.31316429376602173, -0.12478715926408768, -0.1275012195110321, -0.023179389536380768, -0.30671241879463196, 0.12837330996990204, -0.9296752214431763, 1.2703098058700562, -0.7307207584381104, 0.3154323697090149, -0.9922328591346741, 0.335085928440094, 0.185186505317688, 0.62134850025177, 1.8139152526855469, -0.28478333353996277, -0.6657425165176392, -0.06523066014051437, 0.5084587931632996, -0.6367661356925964, -0.24942253530025482, -0.21301862597465515, -0.5619716644287109, -0.21739953756332397, -0.11949378252029419, -0.5329355001449585, 0.9508681893348694, 0.42131370306015015, 0.6913177371025085, -0.5023329257965088, -0.6737396121025085, 0.4202648401260376, -0.5962669253349304, 0.25263121724128723, -1.325942039489746, -0.9539095759391785, 0.32606738805770874, -0.8188132047653198, -0.2594841718673706, 0.46497049927711487, 0.33229508996009827, 0.6612261533737183, 0.1525098830461502, 0.13182386755943298, 0.3281456530094147, -0.061887226998806, -0.5933127999305725, -0.1174294725060463, -1.1236255168914795, 0.7128162384033203, -0.03945128619670868, -0.3307018578052521, 0.6655913591384888, 1.0263328552246094, -0.6829705238342285, -0.27970319986343384, 0.31477028131484985, 0.16058461368083954, 0.21226118505001068, -1.0741336345672607, -0.2630060911178589, -0.3759476840496063, -0.16134369373321533, -0.9323667287826538, 0.304111123085022, -0.6455680727958679, 0.7826105952262878, -0.19250167906284332, -0.38801953196525574, -0.6518416404724121, 0.5179296731948853, -0.1631096601486206, 0.8881076574325562, -0.7847036719322205, 0.9034410119056702, 0.2598922550678253, -0.667485237121582, 0.5489475727081299, -0.15865835547447205, 0.6590776443481445, -0.3029339611530304, -0.09585663676261902, -0.5452804565429688, 0.14332795143127441, -0.24576888978481293, -0.30854886770248413, -0.17088286578655243, -0.5019630193710327, 0.6468048095703125, 0.5690564513206482, -0.03869986906647682, -0.1560218781232834, 0.27727678418159485, -0.7634984254837036, 0.8243139386177063, 0.5036463737487793, -1.0186591148376465, 0.6644127368927002, 0.027251534163951874, -0.04012920707464218, 0.88032466173172, -0.07593114674091339, -0.017634237185120583, -0.33773550391197205, 0.6906982064247131, 1.170836329460144, 0.6906049251556396, 1.2638636827468872, -0.0031264801509678364, -0.8784834742546082, -0.2939242720603943, 0.5120510458946228, 0.04211759939789772, 0.38377684354782104, -0.39345070719718933, -0.3873101472854614, -0.7297289967536926, 0.23667018115520477, -0.680204451084137, 0.9916102290153503, 0.19853045046329498, 0.1832202970981598, 1.0483589172363281, -0.5966649055480957, -0.2582244873046875, -0.63815838098526, -0.19133980572223663, -0.5254195332527161, 0.5488855838775635, 0.18068186938762665, -0.5382696390151978, -0.10025382786989212, -0.4493943750858307, 0.3728162348270416, 0.3218366205692291, -0.26416561007499695, 0.7689904570579529, -0.6775138974189758, -0.6538372039794922, 0.07184797525405884, -0.16085723042488098, -0.09956847876310349, 0.7188088893890381, 0.8476488590240479, 1.2134004831314087, -0.5483765006065369, 0.1644858717918396, -0.13364475965499878, -0.06557242572307587, 0.05244589224457741, -0.7322260737419128, -0.362996906042099, 1.1904276609420776, 0.8591991662979126, -1.1153615713119507, 0.27445387840270996, -0.4947052299976349, 0.09890629351139069, -0.2080918550491333, -0.05663347989320755, 0.8270089626312256, 0.885172426700592, 0.12665648758411407, -0.3393995463848114, 0.5849983096122742, -0.4339640736579895, -0.12324835360050201, -1.254658579826355, 0.5852439999580383, 0.6774754524230957, 1.5826815366744995, 0.26979199051856995, 0.27681270241737366, 0.31688833236694336, 0.34845513105392456, -0.6037394404411316, -0.13933172821998596, 0.6082769632339478, 0.7141236066818237, -0.43407297134399414, -0.9540348649024963, -0.06378434598445892, -0.7165022492408752, -0.10334120690822601, 0.48288899660110474, 0.021393390372395515, 0.08122557401657104, 0.7764209508895874, 0.198629692196846, 0.28345155715942383, -0.08576563000679016, 0.13769377768039703, -0.028633244335651398, 0.13015951216220856, -0.3900812268257141, -0.21153132617473602, -0.49853506684303284, -0.4603061378002167, 0.37672290205955505, -0.41586244106292725, 0.08680986613035202, 0.5042380094528198, -0.09915515035390854, 0.3984903395175934, -0.7229204773902893, -0.6460831165313721, 0.2612278163433075, -0.23122026026248932, 0.4819875955581665, 0.21891601383686066, -0.0632455050945282, -0.17268259823322296, 0.6206010580062866, -0.30965468287467957, 0.5416079163551331, 1.1343287229537964, -0.12452421337366104, -0.9804446697235107, 0.3916241228580475, -0.9025916457176208, 0.45237088203430176, -0.1711345911026001, -0.7681756615638733, 0.4758908748626709, 0.19476722180843353, 0.3740658462047577, 0.24319416284561157, 0.08692318946123123, 1.310978651046753, -0.19087617099285126, 0.4341834783554077, 1.0381677150726318, 0.2361825853586197, -1.2516345977783203, -0.7142848372459412, 0.9108123779296875, 0.7823230028152466, 0.1893194019794464, -0.9152236580848694, 0.6075412034988403, -0.34900420904159546, 0.6791881918907166, -0.6610547304153442, 1.132538914680481, 0.4292915463447571, -0.6006208062171936, 0.06994522362947464, -0.23997263610363007, 0.11156866699457169, 1.4140403270721436, 0.11881516873836517, -0.9865322113037109, -1.2322028875350952, 0.6778845191001892, -0.04960399493575096, 0.9601366519927979, 0.12656456232070923, 0.12933112680912018, 2.2407307624816895, -0.5466830730438232, -0.413527250289917, -0.2768252491950989, 0.469069242477417, -0.06867487728595734, -0.11549513041973114, 0.5395075678825378, -0.7369396686553955, 0.13792464137077332, 0.47607436776161194, -0.06515752524137497, -0.42858394980430603, -0.6536766886711121, 0.5544399619102478, 1.3435701131820679, 0.18065115809440613, -0.4435864984989166, 0.13905292749404907, -0.8335209488868713, 0.427463561296463, -0.01821955293416977, 0.43715816736221313, 0.6267189979553223, -0.19644799828529358, 0.5251560807228088, -0.8310320377349854, 0.3620675802230835, -0.9437296390533447, -0.8113115429878235, 0.3998969793319702, 0.5962125658988953, -0.08420202881097794, -0.57695072889328, -0.08525992184877396, 0.03659139573574066, 0.6586400270462036, 0.4532737135887146, -0.03628167510032654, 1.5121127367019653, -0.922744870185852, -0.031445227563381195, -0.42395663261413574, 0.18543308973312378, -0.05684487149119377, 0.22884680330753326, 1.0923569202423096, 0.48983755707740784, 0.5898116230964661, 0.81036776304245, -0.17718736827373505, -0.8307814598083496, 0.7169293761253357, -0.7997084856033325, -1.1256719827651978, -1.3618370294570923, 0.026212234050035477, 0.33762094378471375, -0.20601041615009308, 0.6045347452163696, 1.0061274766921997, -1.1683212518692017, -0.6458456516265869, 0.05795932933688164, -0.9733226895332336, 0.02346726320683956, 0.1469453126192093, -1.29682457447052, 0.4192703664302826, -0.9976146221160889, -1.1803661584854126, 1.1405552625656128, 0.27714526653289795, -0.5740044116973877, 0.37054774165153503, 0.6915559768676758, 0.5335045456886292, 0.6463086605072021, -0.4450267553329468, 0.2882988750934601, 0.7415408492088318, -0.7954014539718628, -1.4197204113006592, 0.5683300495147705, 0.05397609993815422, 0.03892434760928154, -0.2998378872871399, -0.2845939099788666, -0.36284518241882324, -0.41774722933769226, -0.5770949721336365, -0.3853459656238556, -0.29094916582107544, 0.4868842661380768, 0.3012200891971588, -0.9273547530174255, 0.29685014486312866, -1.3446282148361206, 0.2374153733253479, -0.8523753881454468, 0.8888260126113892, -1.2057350873947144, 0.7523120641708374, -0.26992326974868774, 0.45317837595939636, -0.4336203634738922, 0.11409713327884674, 0.7569641470909119, 0.41097012162208557, 0.4903218746185303, -0.97042316198349, 0.22618155181407928, 0.6581432223320007, -0.08282448351383209, -0.11413247138261795, 1.1108906269073486, 0.11752190440893173, -0.6894633173942566, 0.3611258566379547, 0.08975137770175934, -0.5922926068305969, 0.33476030826568604, 0.755211591720581, -0.2620964050292969, -1.0192923545837402, -0.9818783402442932, -0.22123859822750092, -0.6266299486160278, 0.4633949398994446, -0.5869379639625549, -1.1052576303482056, 0.6410539746284485, -0.48307138681411743, -0.22564852237701416, 0.4250914752483368, -1.0970135927200317, 0.15461398661136627, -0.8269080519676208, 0.8635252118110657, 0.34922221302986145, -0.25312334299087524, 0.4076528549194336, 0.29008984565734863, -0.30968043208122253, 0.19094912707805634, -1.0324103832244873, -0.28983548283576965, 0.6554927825927734, 0.5653368234634399, -0.4948021173477173, 0.713750422000885, 0.5113646388053894, -0.9721914529800415, -0.09601705521345139, 0.15194137394428253, -0.2409432828426361, 0.291204035282135, 0.08812408894300461, 0.18676543235778809, 0.7462406158447266, 1.0181821584701538, -0.3099394738674164, 0.2340196967124939, -0.33959004282951355, 0.38599535822868347, -0.3377949595451355, -0.6896225810050964, -1.3522833585739136, 0.6136596202850342, 0.02643662877380848, 0.10995058715343475, 0.4677075743675232, -1.03464937210083, -0.09359724819660187, -0.3469903767108917, 2.1890487670898438, -1.2798664569854736, 0.825534462928772, -1.368397831916809, -1.2444953918457031, -1.8088722229003906, 0.32032644748687744, -0.18129917979240417, -0.05670265853404999, 0.018570495769381523, 0.6716850399971008, 0.6877224445343018, -0.47368666529655457, 0.2316894382238388, 0.3913774788379669, 0.074130117893219, -1.0380651950836182, 0.8455272316932678, 0.29951179027557373, 0.44667142629623413, -0.17355704307556152, 1.9317564964294434, 1.3467512130737305, 0.1560761034488678, 0.46046918630599976, -0.020872360095381737, -0.4430123567581177, 0.47270992398262024, -0.9123899936676025, -1.344541311264038, 0.39359554648399353, 0.03461732342839241, 0.074502132833004, -0.5889225006103516, -0.39849182963371277, 0.490336149930954, 0.07989828288555145, 0.2861008048057556, 0.9119997620582581, -1.0091897249221802, -0.4579299986362457, 0.42552417516708374, 0.10140134394168854, 0.5025582313537598, 0.6983601450920105, 0.0649091899394989, 0.5735647678375244, 0.7005746960639954, 0.9210378527641296, 0.1999170333147049, -0.7702190279960632, 0.47088807821273804, 0.5863855481147766, 0.50691157579422, 0.16944997012615204, -0.4440843462944031, -1.8733270168304443, -0.18401873111724854, -0.35695183277130127, -0.4195825159549713, -0.0994340032339096, -0.8620306253433228, -0.7085175514221191, 1.1929875612258911, -0.6194138526916504, -0.46039921045303345, 0.16510255634784698, 0.8274635672569275, -0.45603036880493164, -0.3969375789165497, 1.3685225248336792, -0.08666238933801651, 0.16118483245372772, -0.02087322250008583, 0.5933021903038025, -0.31219419836997986, 0.23491019010543823, -0.037453170865774155, 0.27429282665252686, -0.3336316645145416, -0.8412371277809143, -0.3037071228027344, 0.9278504848480225, -0.2117251306772232, 0.39157989621162415, 0.19420254230499268, 0.7972860932350159, -0.0345768928527832, -0.43267083168029785, 0.1256203055381775, 0.04268502816557884, 0.6245540380477905, -0.15467628836631775, -0.7755571603775024, -0.4335850179195404, 0.03914282098412514, -0.42413920164108276, 0.34789228439331055, -0.9203366637229919, 0.4343831241130829, 0.9631713628768921, -0.6619488596916199, -0.023344960063695908, -0.4423201084136963, 1.5231460332870483, -0.9946919083595276, 0.7638593316078186, -0.42985546588897705, -0.7023813724517822, -0.7648715376853943, -0.2787427008152008, -0.3287091553211212, -0.4728955626487732, -0.07113252580165863, 0.6156468391418457, -0.6274003982543945, 0.45945799350738525, -0.7625044584274292, 0.274333655834198, 0.8682374358177185, 0.2192758172750473, 0.23985058069229126, -0.1764305979013443, -0.41148197650909424, -0.19243532419204712, 0.32216712832450867, -0.41912320256233215, 0.18753033876419067, 0.887019157409668, 1.6789131164550781, 0.8708255290985107, 0.27678993344306946, 0.33362266421318054, 0.5389842391014099, -0.2981942296028137, -0.3140742778778076, -1.622700572013855, -0.9923866987228394, -0.2605375051498413], '_distance': 373.3919677734375})]\n"
     ]
    }
   ],
   "source": [
    "print(result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "01d295fb-045e-49f3-95f0-3289ea58a957",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
